package com.cn.wanxi.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class NewsModel {
    private String href;//新闻链接
    private String title;//新闻标题
    private String content;//新闻内容

    private String[] hrefs = {"#", "#", "#"};
    private String[] titles = {"日本较大抹茶督饮七叶和茶登陆上海", "日本较大抹茶督饮七叶和茶登陆上海", "日本较大抹茶督饮七叶和茶登陆上海"};
    private String[] contents = {"日本较大的抹茶", "日本较大的抹茶日本较大的抹茶日本较大的抹茶日本较大的抹茶", "日本较大的抹茶日本较大的抹茶日本较大的抹茶日本较大的抹茶日本较大的抹茶日本较大的抹茶日本较大的抹茶"};

    private String createTime;//日期

    private String[] newsTitles = {"两部门开展餐饮服务食品安全百千万示范工程建设",
            "两部门开展餐饮服务食品安全百千万示范工程建设",
            "两部门开展餐饮服务食品安全百千万示范工程建设",
            "两部门开展餐饮服务食品安全百千万示范工程建设",
            "两部门开展餐饮服务食品安全百千万示范工程建设",
            "两部门开展餐饮服务食品安全百千万示范工程建设",
            "两部门开展餐饮服务食品安全百千万示范工程建设"};

    private String[] newsCreateTimes = {"2020-5-22",
            "2020-5-22",
            "2020-5-22",
            "2020-5-22",
            "2020-5-22",
            "2020-5-22",
            "2020-5-22"};
    private List<NewsModel> newsPageList = new ArrayList<>();

    /**
     * 得到新闻页面的newsPageList
     *
     * @return
     */
    public List<NewsModel> getNewsPageList() {
        for (int i = 0; i < newsTitles.length; i++) {
            NewsModel newsModel = new NewsModel();//创建对象
            newsModel.setTitle(newsTitles[i]);
            newsModel.setCreateTime(newsCreateTimes[i]);
            newsPageList.add(newsModel);//将新闻信息加入到list集合
        }
        return newsPageList;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    //网站首页的list
    private List<NewsModel> list = new ArrayList<>();


    /**
     * 封装新闻信息到集合
     *
     * @return
     */
    public List<NewsModel> getList() {
        for (int i = 0; i < hrefs.length; i++) {
            NewsModel newsModel = new NewsModel();//创建对象
            newsModel.setHref(hrefs[i]);
            newsModel.setTitle(titles[i]);
            newsModel.setContent(contents[i]);
            list.add(newsModel);//将新闻信息加入到list集合
        }
        return list;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}
